package entities;

import com.haxepunk.Entity;
import com.haxepunk.graphics.Image;
import com.haxepunk.tmx.TmxObject;
import com.haxepunk.utils.Key;
import com.haxepunk.utils.Input;
import com.haxepunk.HXP;

/**
 * ...
 * @author ... Marcelo Ruben Guardia
 */
class Gun extends Entity {
	private var imgGun:Image;
	private var _angle:Float;
	private var modShoot:Float;

	public function new(obj:TmxObject)
 {
		super(obj.x, obj.y);
		
		imgGun = new Image(GC.IMG_gun);
		imgGun.scale = 0.275;
		imgGun.centerOrigin();
		graphic = imgGun;
		type = "gun";
		
		_angle = 0;
		modShoot = 10;
		layer = -2;
	}
	
	public function SetAngle(newAngle:Float):Void
	{
		imgGun.angle = newAngle;
	}
	
	public function Shoot():Void
	{
		scene.add(new Proyectil(x, y, imgGun.angle+90, 20, GC.IMG_laser_bullet));
	}
	
}